
class X
{
public:
	X(int n) : m_n(n){ }

	//X operator+(const X& other) const {
	//	return X(m_n + other.m_n);
	//}

	

private:
	friend X operator+(const X& lhs, const X& rhs) {
		return X(lhs.m_n + rhs.m_n);
	}

	int m_n;
};

void main()
{
	X a(1);
	int b = 2;

	X d = a + b; // works with both: a.operator+(b)
	X e = b + a; // works with global friend version only: b.operator+(a)
}